home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / ircii2-6.zip / SCRIPTS\HISTORY < prev    next >
Text File  |  1994-12-28  |  2KB  |  69 lines

  1. # history - provide a little control over the last word of the last 
  2. #           commands.   !$ matches the last word in the last line typed
  3. #           insert it as many times as desired.
  4. # version 1.0
  5. #           Now you can use !0 !1 !2  etc.. as well as !$  The numbers are 
  6. #           restricted to the range 0 thru 9.  
  7. #           Also !* expands to the whole line..
  8. # version 2.0
  9. #           by Ian Frechette and Matthew Green
  10. # version 2.1
  11. #           Fixed !* to not include the first word, and added !!
  12.  
  13. @ hs.on = 1
  14. @ hs.lline - []
  15. bind ^K meta3
  16. #bind meta3-h parse @ hs.on = 1 - hs.on
  17. bind meta3-h parse @ hs.on = 1 - hs.on;if (hs.on) { ^set -status_user1 } { ^set status_user1  - no history }
  18.  
  19. set input_protection off
  20. on ^input * if (hs.on) { sendline $hs.eval($*) } { sendline $* }
  21.  
  22. alias allbutfirst @ function_return = [$1-]
  23.  
  24. alias hs.eval
  25. {
  26.     @hs.line = [$*]
  27.     @hs.mark = index(! $hs.line)
  28.     @ hs.nline = []
  29.     if (@hs.line)
  30.     {
  31.         while (hs.mark > -1)
  32.         {
  33.             @hs.nline = hs.nline ## left($hs.mark $hs.line)
  34.             @hs.num = mid(${hs.mark+1} 1 $hs.line)
  35.             if (index(0123456789*!$$ $hs.num) > -1)
  36.             {
  37.                 if (hs.num == [$$])
  38.                 {
  39.                     @hs.word = word(${#hs.lline-1} $hs.lline)
  40.                 }
  41.                 {
  42.                 if (hs.num == [!])
  43.                 {
  44.                     @hs.word = hs.lline
  45.                 }
  46.                 {
  47.                 if (hs.num == [*])
  48.                 {
  49.                     @hs.word = allbutfirst($hs.lline)
  50.                 }
  51.                 {
  52.                      @hs.word = word($hs.num $hs.lline)
  53.                 } } }
  54.                 @hs.nline = hs.nline ## hs.word
  55.                 @hs.line = mid(${hs.mark + 2} 999 $hs.line)
  56.             }
  57.             {
  58.                 @hs.nline = hs.nline ## [!]
  59.                 @hs.line = mid(${hs.mark + 1} 999 $hs.line)
  60.             }
  61.             @hs.mark = index(! $hs.line)
  62.         }
  63.         @ hs.nline = hs.nline ## hs.line
  64.         @ hs.lline = hs.nline
  65.     }
  66.     @ function_return = hs.nline
  67. }
  68.  
  69.